package com.qfedu.Exception;

import com.qfedu.entity.Message;
import com.qfedu.entity.ResponseData;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@ControllerAdvice

/**
 * 异常处理机制
 */
public class AppException {


    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Message exceptionHand(Exception e){
        Message message = new Message();
        message.setMsg("服务器异常e:"+e.getMessage());
        return message;
    }
}
